package cn.edu.hnu.matching.exception;

import cn.edu.hnu.matching.common.ResultCode;

/**
 * 业务异常封装
 *
 * @author n70huihui
 * @since 2025-04-10
 */
public class BusinessException extends RuntimeException {

    /**
     * 错误码
     */
    private final int code;

    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(ResultCode resultCode) {
        super(resultCode.getMessage());
        this.code = resultCode.getCode();
    }

    public BusinessException(ResultCode resultCode, String message) {
        super(message);
        this.code = resultCode.getCode();
    }

    public int getCode() {
        return this.code;
    }

}
